#include "gdkmain.h"
#include "gdkwindow.h"
-/**
- * gdk_pointer_ungrab:
- * @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
- * timestamp is available.
- *
- * Ungrabs the pointer on the default display, if it is grabbed by this
- * application.
- *
- * Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
- * instead.
- **/
-void
-gdk_pointer_ungrab (guint32 time)
-{
- gdk_display_pointer_ungrab (gdk_display_get_default (), time);
-}
-
-/**
- * gdk_pointer_is_grabbed:
- *
- * Returns %TRUE if the pointer on the default display is currently
- * grabbed by this application.
- *
- * Note that this does not take the inmplicit pointer grab on button
- * presses into account.
- *
- * Returns: %TRUE if the pointer is currently grabbed by this application.
- *
- * Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
- **/
-gboolean
-gdk_pointer_is_grabbed (void)
-{
- return gdk_display_pointer_is_grabbed (gdk_display_get_default ());
-}
-
-/**
- * gdk_keyboard_ungrab:
- * @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
- * timestamp is available.
- *
- * Ungrabs the keyboard on the default display, if it is grabbed by this
- * application.
- *
- * Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
- * instead.
- **/
-void
-gdk_keyboard_ungrab (guint32 time)
-{
- gdk_display_keyboard_ungrab (gdk_display_get_default (), time);
-}
-
/**
* gdk_window_at_pointer:
* @win_x: (out) (allow-none): return location for origin of the window under the pointer
* @device: device to get the grab information from
* @grab_window: (out) (transfer none): location to store current grab window
* @owner_events: (out): location to store boolean indicating whether
- * the @owner_events flag to gdk_keyboard_grab() or
- * gdk_pointer_grab() was %TRUE.
+ * the @owner_events flag to gdk_device_grab() was %TRUE.
*
* Determines information about the current keyboard grab.
* This is not public API and must not be used by applications.
return FALSE;
}
-/**
- * gdk_device_grab_info_libgtk_only:
- * @display: the display for which to get the grab information
- * @device: device to get the grab information from
- * @grab_window: (out) (transfer none): location to store current grab window
- * @owner_events: (out): location to store boolean indicating whether
- * the @owner_events flag to gdk_keyboard_grab() or
- * gdk_pointer_grab() was %TRUE.
- *
- * Determines information about the current keyboard grab.
- * This is not public API and must not be used by applications.
- *
- * Returns: %TRUE if this application currently has the
- * keyboard grabbed.
- *
- * Deprecated: 3.16: The symbol was never meant to be used outside
- * of GTK+
- */
-gboolean
-gdk_device_grab_info_libgtk_only (GdkDisplay *display,
- GdkDevice *device,
- GdkWindow **grab_window,
- gboolean *owner_events)
-{
- return gdk_device_grab_info (display, device, grab_window, owner_events);
-}
-
-/**
- * gdk_display_pointer_is_grabbed:
- * @display: a #GdkDisplay
- *
- * Test if the pointer is grabbed.
- *
- * Returns: %TRUE if an active X pointer grab is in effect
- *
- * Since: 2.2
- *
- * Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
- */
-gboolean
-gdk_display_pointer_is_grabbed (GdkDisplay *display)
-{
- GList *seats, *s;
- GdkDevice *device;
-
- g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
-
- seats = gdk_display_list_seats (display);
-
- for (s = seats; s; s = s->next)
- {
- device = gdk_seat_get_pointer (s->data);
-
- if (gdk_display_device_is_grabbed (display, device))
- {
- g_list_free (seats);
- return TRUE;
- }
- }
-
- g_list_free (seats);
-
- return FALSE;
-}
-
/**
* gdk_display_device_is_grabbed:
* @display: a #GdkDisplay
_gdk_display_enable_motion_hints (display, device);
}
-/**
- * gdk_pointer_grab:
- * @window: the #GdkWindow which will own the grab (the grab window).
- * @owner_events: if %FALSE then all pointer events are reported with respect to
- * @window and are only reported if selected by @event_mask. If %TRUE then pointer
- * events for this application are reported as normal, but pointer events outside
- * this application are reported with respect to @window and only if selected by
- * @event_mask. In either mode, unreported events are discarded.
- * @event_mask: specifies the event mask, which is used in accordance with
- * @owner_events. Note that only pointer events (i.e. button and motion events)
- * may be selected.
- * @confine_to: (allow-none): If non-%NULL, the pointer will be confined to this
- * window during the grab. If the pointer is outside @confine_to, it will
- * automatically be moved to the closest edge of @confine_to and enter
- * and leave events will be generated as necessary.
- * @cursor: (allow-none): the cursor to display while the grab is active. If this is %NULL then
- * the normal cursors are used for @window and its descendants, and the cursor
- * for @window is used for all other windows.
- * @time_: the timestamp of the event which led to this pointer grab. This usually
- * comes from a #GdkEventButton struct, though %GDK_CURRENT_TIME can be used if
- * the time isn’t known.
- *
- * Grabs the pointer (usually a mouse) so that all events are passed to this
- * application until the pointer is ungrabbed with gdk_pointer_ungrab(), or
- * the grab window becomes unviewable.
- * This overrides any previous pointer grab by this client.
- *
- * Pointer grabs are used for operations which need complete control over mouse
- * events, even if the mouse leaves the application.
- * For example in GTK+ it is used for Drag and Drop, for dragging the handle in
- * the #GtkHPaned and #GtkVPaned widgets.
- *
- * Note that if the event mask of an X window has selected both button press and
- * button release events, then a button press event will cause an automatic
- * pointer grab until the button is released.
- * X does this automatically since most applications expect to receive button
- * press and release events in pairs.
- * It is equivalent to a pointer grab on the window with @owner_events set to
- * %TRUE.
- *
- * If you set up anything at the time you take the grab that needs to be cleaned
- * up when the grab ends, you should handle the #GdkEventGrabBroken events that
- * are emitted when the grab ends unvoluntarily.
- *
- * Returns: %GDK_GRAB_SUCCESS if the grab was successful.
- *
- * Deprecated: 3.0: Use gdk_device_grab() instead.
- **/
-GdkGrabStatus
-gdk_pointer_grab (GdkWindow * window,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- GdkCursor * cursor,
- guint32 time)
-{
- GdkWindow *native;
- GdkDisplay *display;
- GdkDevice *device;
- GdkGrabStatus res = 0;
- gulong serial;
- GList *seats, *s;
-
- g_return_val_if_fail (window != NULL, GDK_GRAB_FAILED);
- g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_FAILED);
- g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), GDK_GRAB_FAILED);
-
- /* We need a native window for confine to to work, ensure we have one */
- if (confine_to)
- {
- if (!gdk_window_ensure_native (confine_to))
- {
- g_warning ("Can't confine to grabbed window, not native");
- confine_to = NULL;
- }
- }
-
- /* Non-viewable client side window => fail */
- if (!_gdk_window_has_impl (window) &&
- !gdk_window_is_viewable (window))
- return GDK_GRAB_NOT_VIEWABLE;
-
- native = gdk_window_get_toplevel (window);
- while (gdk_window_is_offscreen (native))
- {
- native = gdk_offscreen_window_get_embedder (native);
-
- if (native == NULL ||
- (!_gdk_window_has_impl (native) &&
- !gdk_window_is_viewable (native)))
- return GDK_GRAB_NOT_VIEWABLE;
-
- native = gdk_window_get_toplevel (native);
- }
-
- display = gdk_window_get_display (window);
-
- serial = _gdk_display_get_next_serial (display);
- seats = gdk_display_list_seats (display);
-
- for (s = seats; s; s = s->next)
- {
- device = gdk_seat_get_pointer (s->data);
-
- res = GDK_DEVICE_GET_CLASS (device)->grab (device,
- native,
- owner_events,
- get_native_grab_event_mask (event_mask),
- confine_to,
- cursor,
- time);
-
- if (res == GDK_GRAB_SUCCESS)
- _gdk_display_add_device_grab (display,
- device,
- window,
- native,
- GDK_OWNERSHIP_NONE,
- owner_events,
- event_mask,
- serial,
- time,
- FALSE);
- }
-
- /* FIXME: handle errors when grabbing */
-
- g_list_free (seats);
-
- return res;
-}
-
-/**
- * gdk_keyboard_grab:
- * @window: the #GdkWindow which will own the grab (the grab window).
- * @owner_events: if %FALSE then all keyboard events are reported with respect to
- * @window. If %TRUE then keyboard events for this application are
- * reported as normal, but keyboard events outside this application
- * are reported with respect to @window. Both key press and key
- * release events are always reported, independant of the event mask
- * set by the application.
- * @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no timestamp is
- * available.
- *
- * Grabs the keyboard so that all events are passed to this
- * application until the keyboard is ungrabbed with gdk_keyboard_ungrab().
- * This overrides any previous keyboard grab by this client.
- *
- * If you set up anything at the time you take the grab that needs to be cleaned
- * up when the grab ends, you should handle the #GdkEventGrabBroken events that
- * are emitted when the grab ends unvoluntarily.
- *
- * Returns: %GDK_GRAB_SUCCESS if the grab was successful.
- *
- * Deprecated: 3.0: Use gdk_device_grab() instead.
- **/
-GdkGrabStatus
-gdk_keyboard_grab (GdkWindow *window,
- gboolean owner_events,
- guint32 time)
-{
- GdkWindow *native;
- GdkDisplay *display;
- GdkDevice *device;
- GdkGrabStatus res = 0;
- gulong serial;
- GList *seats, *s;
-
- g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_FAILED);
-
- /* Non-viewable client side window => fail */
- if (!_gdk_window_has_impl (window) &&
- !gdk_window_is_viewable (window))
- return GDK_GRAB_NOT_VIEWABLE;
-
- native = gdk_window_get_toplevel (window);
-
- while (gdk_window_is_offscreen (native))
- {
- native = gdk_offscreen_window_get_embedder (native);
-
- if (native == NULL ||
- (!_gdk_window_has_impl (native) &&
- !gdk_window_is_viewable (native)))
- return GDK_GRAB_NOT_VIEWABLE;
-
- native = gdk_window_get_toplevel (native);
- }
-
- display = gdk_window_get_display (window);
- serial = _gdk_display_get_next_serial (display);
- seats = gdk_display_list_seats (display);
-
- for (s = seats; s; s = s->next)
- {
- device = gdk_seat_get_keyboard (s->data);
-
- res = GDK_DEVICE_GET_CLASS (device)->grab (device,
- native,
- owner_events,
- GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
- NULL,
- NULL,
- time);
-
- if (res == GDK_GRAB_SUCCESS)
- _gdk_display_add_device_grab (display,
- device,
- window,
- native,
- GDK_OWNERSHIP_NONE,
- owner_events, 0,
- serial,
- time,
- FALSE);
- }
-
- /* FIXME: handle errors when grabbing */
-
- g_list_free (seats);
-
- return res;
-}
-
/**
* gdk_window_geometry_changed:
* @window: an embedded offscreen #GdkWindow